package com.qige.homework;

public class day16_homework3 {
    public static void main(String[] args) {
        Player p = new Player();
        p.FightAble_select("mage");
        p.FightAble_select("warrior");
    }
}
interface FightAble{
    abstract void specialFight();
    default void commonFight(){
        System.out.println("普通打击");
    }
}
class warrior implements FightAble{
    public void specialFight(){
        System.out.println("武器攻击");
    }
}
class Mage implements FightAble{
    public void specialFight(){
        System.out.println("法术攻击");
    }
}
class Player{
    public static void FightAble_select(String str){
        if("warrior".equals(str)){
            System.out.println("选择:武力角色");
            warrior w = new warrior();
            w.specialFight();
            w.commonFight();
        }else if("mage".equals(str)){
            System.out.println("选择:法力角色");
            Mage m = new Mage();
            m.specialFight();
            m.commonFight();
        }else{
            System.out.println("输入有误");
        }
    }
}